package com.my.chapter11;

import java.util.ArrayList;
import java.util.List;

public class practice7 {
    public static void main(String[] args) {
        List<Pet> pets = new ArrayList<Pet>();
        for(int i=0;i<6;i++){
            pets.add(new Pet());
        }
        System.out.println(pets);
        List<Pet> sub = pets.subList(1,3);
        System.out.println(sub);
        pets.removeAll(sub);
        System.out.println(pets);
    }
}

class Pet{
    static int count = 0;
    int id = 0;
    public Pet(){
        count++;
        id = count;
    }

    @Override
    public String toString() {
        return "Pet"+id;
    }
}